package com.ostrich.module_more.themes.adapter

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ostrich.library_base.BaseViewModel
import com.ostrich.module_more.databinding.MoreItemThemesViewBinding
import com.ostrich.module_more.themes.entity.ThemesDataEntity

/**
 * @Author : yaotianxue
 * @Time : On 2023/11/2 09:50
 * @Description : ThemesDataAdapter
 */
class ThemesDataAdapter(private val layoutResId: Int,
                        data: MutableList<ThemesDataEntity>):BaseQuickAdapter<ThemesDataEntity,BaseViewHolder>(layoutResId,data) {
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
       DataBindingUtil.bind<MoreItemThemesViewBinding>(viewHolder.itemView)
    }
    override fun convert(holder: BaseViewHolder, item: ThemesDataEntity) {
        holder.getBinding<MoreItemThemesViewBinding>()?.viewModel = item
        holder.getBinding<MoreItemThemesViewBinding>()?.executePendingBindings()
    }
}